@import '../styles/var.scss';

.van-loading {
  z-index: 0;
  font-size: 0;
  line-height: 0;
  position: relative;
  display: inline-block;
  vertical-align: middle;

  &__spinner {
    z-index: -1;
    width: 100%;
    height: 100%;
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    animation: van-rotate 0.8s linear infinite;

    &--spinner {
      animation-timing-function: steps(12);
    }

    &--circular {
      border: 1px solid;
      border-radius: 100%;
      border-color: currentColor;
      border-top-color: transparent;
    }
  }

  &__dot {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    position: absolute;

    &::before {
      width: 2px;
      height: 25%;
      content: ' ';
      display: block;
      margin: 0 auto;
      border-radius: 40%;
      background-color: currentColor;
    }
  }
}

@for $i from 1 to 12 {
  .van-loading__dot:nth-of-type(#{$i}) {
    opacity: 1 - (0.75 / 12) * ($i - 1);
    transform: rotate($i * 30deg);
  }
}

@keyframes van-rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}